package com.fix.demo.day3;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HeroController {

	
	@Autowired
	HeroService heroService;
	
	@RequestMapping("/hero/{page}")
	public String gethero(@PathVariable("page") int page,ModelMap map) {
		List list =heroService.getPage(page);
		
		map.addAttribute("heros", list);  //传给网页
		return "show";
	}
}
